

const express = require('express');
// https配置
const https = require('https');
const fs = require('fs');

const app = express();

app.use(express.static('public')); // 确保 public 目录存在且包含你的静态文件。

const mainFun = require('./src/main')
mainFun(app)


app.listen(80, () => {
    console.log(`Server is running on http://localhost:80`);
});

// ssl证书
const options = {
  key: fs.readFileSync('./ssl/wutianci.top.key'),
  cert: fs.readFileSync('./ssl/wutianci.top_bundle.pem')
};
https.createServer(options, app).listen(443, () => {
  console.log('HTTPS Server running on port 443');
});
